package cn.heima.com;

import java.util.ArrayList;

public class demo1 {
    public static void main(String[] args) {
        /*
        * 分析以下需求，并用代码实现：
	(1)统计每个单词出现的次数
	(2)有如下字符串"If you want to change your fate I think you must come to the dark horse to learn java"(用空格间隔)
	(3)打印格式：
		to=3
  		think=1
  		you=2
  		//........
        * */
        String s = "If you want to change your fate I think you must come to the dark horse to learn java";
        String[] s1 = s.split(" ");
        ArrayList<String> arrayList = new ArrayList<>();
        for (String str: s1){
            arrayList.add(str);
        }
        for (int i = 0; i < arrayList.size(); i++) {
          String str  = arrayList.get(i);
          boolean t = str.contains("If");

        }
    }
}
